<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>管理员控制台 - 电力收费管理系统</title>
    <!-- Bootstrap CSS -->
    <link href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/4.6.0/css/bootstrap.min.css" rel="stylesheet">
    <!-- Font Awesome -->
    <link href="https://cdn.bootcdn.net/ajax/libs/font-awesome/5.15.3/css/all.min.css" rel="stylesheet">
    <!-- DataTables -->
    <link href="https://cdn.datatables.net/1.10.24/css/dataTables.bootstrap4.min.css" rel="stylesheet">
    <!-- 自定义CSS -->
    <link href="/admin/css/dashboard.css" rel="stylesheet">
</head>
<body>
    <nav class="navbar navbar-dark sticky-top bg-dark flex-md-nowrap p-0 shadow">
        <a class="navbar-brand col-md-3 col-lg-2 mr-0 px-3" href="#">电力收费管理系统</a>
        <button class="navbar-toggler position-absolute d-md-none collapsed" type="button" data-toggle="collapse" data-target="#sidebarMenu">
            <span class="navbar-toggler-icon"></span>
        </button>
        <ul class="navbar-nav px-3">
            <li class="nav-item text-nowrap">
                <a class="nav-link" href="#" id="logoutBtn">
                    <i class="fas fa-sign-out-alt"></i> 退出
                </a>
            </li>
        </ul>
    </nav>

    <div class="container-fluid">
        <div class="row">
            <nav id="sidebarMenu" class="col-md-3 col-lg-2 d-md-block bg-light sidebar collapse">
                <div class="sidebar-sticky pt-3">
                    <ul class="nav flex-column">
                        <li class="nav-item">
                            <a class="nav-link active" href="#" data-page="dashboard">
                                <i class="fas fa-home"></i> 首页
                            </a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" href="#" data-page="customers">
                                <i class="fas fa-users"></i> 客户管理
                            </a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" href="#" data-page="meters">
                                <i class="fas fa-tachometer-alt"></i> 电表管理
                            </a>
                        </li>

                        <li class="nav-item">
                            <a class="nav-link" href="#" data-page="meter-reading">
                                <i class="fas fa-clipboard-list"></i> 抄表录入
                            </a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" href="#" data-page="pricing">
                                <i class="fas fa-dollar-sign"></i> 电价设置
                            </a>
                        </li>
                    </ul>
                </div>
            </nav>

            <main role="main" class="col-md-9 ml-sm-auto col-lg-10 px-md-4">
                <!-- 内容区域 -->
                <div id="content">
                    <!-- 各个页面的内容将通过JavaScript动态加载到这里 -->
                </div>
            </main>
        </div>
    </div>

    <!-- 模态框集合 -->
    <!-- 客户管理模态框 -->
    <div class="modal fade" id="customerModal" tabindex="-1">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title">客户信息</h5>
                    <button type="button" class="close" data-dismiss="modal">
                        <span>&times;</span>
                    </button>
                </div>
                <div class="modal-body">
                    <form id="customerForm">
                        <div class="form-group">
                            <label>户号</label>
                            <input type="text" class="form-control" id="customerNo" required>
                        </div>
                        <div class="form-group">
                            <label>户名</label>
                            <input type="text" class="form-control" id="customerName" required>
                        </div>
                        <div class="form-group">
                            <label>地址</label>
                            <input type="text" class="form-control" id="address" required>
                        </div>
                        <div class="form-group">
                            <label>联系电话</label>
                            <input type="tel" class="form-control" id="phone" required>
                        </div>
                        <div class="form-group">
                            <label>用电类型</label>
                            <select class="form-control" id="electricityType" required>
                                <option value="RESIDENTIAL">居民用电</option>
                                <option value="COMMERCIAL">商业用电</option>
                            </select>
                        </div>
                    </form>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
                    <button type="button" class="btn btn-primary" id="saveCustomer">保存</button>
                </div>
            </div>
        </div>
    </div>

    <!-- 电表管理模态框 -->
    <div class="modal fade" id="meterModal" tabindex="-1">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title">电表信息</h5>
                    <button type="button" class="close" data-dismiss="modal">
                        <span>&times;</span>
                    </button>
                </div>
                <div class="modal-body">
                    <form id="meterForm">
                        <div class="form-group">
                            <label>表号</label>
                            <input type="text" class="form-control" id="meterNo" required>
                        </div>
                        <div class="form-group">
                            <label>关联客户户号</label>
                            <select class="form-control" id="customerNoSelect" required>
                                <!-- 将通过API动态加载客户列表 -->
                            </select>
                        </div>
                        <div class="form-group">
                            <label>型号</label>
                            <input type="text" class="form-control" id="meterModel" required>
                        </div>
                        <div class="form-group">
                            <label>安装日期</label>
                            <input type="date" class="form-control" id="installationDate" required>
                        </div>
                        <div class="form-group">
                            <label>倍率</label>
                            <input type="number" class="form-control" id="multiplier" required min="1" step="0.01">
                        </div>
                        <div class="form-group">
                            <label>当前读数</label>
                            <input type="number" class="form-control" id="currentReading" min="0" step="0.01">
                        </div>
                    </form>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
                    <button type="button" class="btn btn-primary" id="saveMeter">保存</button>
                </div>
            </div>
        </div>
    </div>

    <!-- 抄表录入模态框 -->
    <div class="modal fade" id="readingModal" tabindex="-1">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title">抄表录入</h5>
                    <button type="button" class="close" data-dismiss="modal">
                        <span>&times;</span>
                    </button>
                </div>
                <div class="modal-body">
                    <form id="readingForm">
                        <div class="form-group">
                            <label>电表号</label>
                            <select class="form-control" id="meterNoSelect" required>
                                <!-- 将通过API动态加载电表列表 -->
                            </select>
                        </div>
                        <div class="form-group">
                            <label>本次读数</label>
                            <input type="number" class="form-control" id="newReading" required min="0" step="0.01">
                        </div>
                        <div class="form-group">
                            <label>抄表日期</label>
                            <input type="date" class="form-control" id="readingDate" required>
                        </div>
                        <div class="form-group">
                            <label>计算结果</label>
                            <div class="card">
                                <div class="card-body">
                                    <p>上次读数：<span id="lastReading">0</span></p>
                                    <p>倍率：<span id="meterMultiplier">1</span></p>
                                    <p>本次用电量：<span id="consumption">0</span> 千瓦时</p>
                                    <p>应收金额：<span id="amount">0</span> 元</p>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
                    <button type="button" class="btn btn-primary" id="saveReading">保存</button>
                </div>
            </div>
        </div>
    </div>

    <!-- 电价设置模态框 -->
    <div class="modal fade" id="priceModal" tabindex="-1">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title">电价设置</h5>
                    <button type="button" class="close" data-dismiss="modal">
                        <span>&times;</span>
                    </button>
                </div>
                <div class="modal-body">
                    <form id="priceForm">
                        <input type="hidden" id="priceType">
                        <div class="form-group">
                            <label>居民用电价格（元/千瓦时）</label>
                            <input type="number" class="form-control" id="residentialPrice" step="0.01" min="0">
                        </div>
                        <div class="form-group">
                            <label>商业用电价格（元/千瓦时）</label>
                            <input type="number" class="form-control" id="commercialPrice" step="0.01" min="0">
                        </div>
                    </form>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
                    <button type="button" class="btn btn-primary" id="savePrice">保存</button>
                </div>
            </div>
        </div>
    </div>

    <!-- Bootstrap JS 和依赖 -->
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
    <script src="https://cdn.bootcdn.net/ajax/libs/popper.js/1.16.1/umd/popper.min.js"></script>
    <script src="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/4.6.0/js/bootstrap.min.js"></script>
    <!-- DataTables -->
    <script src="https://cdn.datatables.net/1.10.24/js/jquery.dataTables.min.js"></script>
    <script src="https://cdn.datatables.net/1.10.24/js/dataTables.bootstrap4.min.js"></script>
    <!-- 自定义JS -->
    <script src="/admin/js/dashboard.js"></script>
</body>
</html> 